<?php

class Application_Form_Order extends Zend_Form
{
    private $view;
    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
        $this->view = Zend_Layout::getMvcInstance()->getView();
        
        // create id element
        $id = $this->createElement("hidden","orders_id");
        $id->setDecorators(array("ViewHelper"));
        $this->addElement($id);
        
        // create element status
        $status = $this->createElement("select","status_id");
        $status->setLabel("Tình trạng hóa đơn")->addMultiOptions(array("Tình trạng..."))
                  ->addValidators(array(
                        array("GreaterThan",false,array("min"=>0,"messages"=>array('notGreaterThan'=>"Cần phải chọn một tình trạng."))),
                  ));
        $this->addElement($status);
        
        // create element brand
        $send_email = $this->createElement("checkbox","notify_customer");
        
        $send_email->setLabel("gửi email cho khách hàng")
        ->setAttrib("class","fancy-checkbox");
        $this->addElement($send_email);

         //create element description
        $comment = $this->createElement("textarea","comment");
        $comment->setLabel("Nhận xét")
                    ->setAttribs(array(
                        'class' => "ckeditor",
                        'rows' => 7
                    ));
        $this->addElement($comment);
              
        // create submit button
        $submit = $this->createElement("submit","submit");
        $submit->setLabel("Lưu")
               ->setAttrib("class","btn btn-navy");
        $this->addElement($submit);
        
        
        // create submit button reset
        $reset = $this->createElement("reset","reset");
        $reset->setLabel("Nhập lại")
              ->setAttrib("class","btn btn-navy");
        $this->addElement($reset);
        
        // create submit button cancel
        $link = $this->view->url(array(
            'module'=>"admin",
            'controller'=>"orders",
            'action'=>"index"
        ));
        $cancel = $this->createElement("button","cancel");
        $cancel->setLabel("Quay lại")
               ->setAttrib("class","btn btn-navy")
               ->setAttrib("onclick","window.location='$link'");
        $this->addElement($cancel);
        
    }
}